<template>
  <div id="three-main" class="login-container">
    <transition name="show" mode="out-in">
      <div class="login-form">
        <section>
          <el-tabs
            v-model="activeName"
            class="demo-tabs"
            @tab-click="handleClick"
          >
            <el-tab-pane label="二维码登录" name="qrcode">
              <QRCode />
            </el-tab-pane>
            <el-tab-pane label="账号密码登录" name="username">
              <From />
            </el-tab-pane>
          </el-tabs>
          <!-- <footer>© 2020 中国电信温州分公司， Inc. All rights reserved</footer> -->
        </section>
      </div>
    </transition>
  </div>
</template>

<script>
import { defineComponent, nextTick, onMounted, reactive, ref } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import From from "./components/Form.vue";
import QRCode from "./components/QRCode.vue";
import { getToken } from '@/utils/auth' // get token from cookie
export default defineComponent({
  name: "Login",
  components: { From, QRCode },
  setup() {
    const activeName = ref("qrcode");
    const handleClick = (tab, event) => {
      // console.log(event)
    };
    // alert(getToken())
    return {
      activeName,
      handleClick,
    };
  },
});
</script>
<style lang="scss" scoped>
$bg: #fff;
$dark_gray: #606266;
$light_gray: #889aa4;
ul,
li,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.svg-icon {
  vertical-align: -0.05em;
}
.el-main {
  padding: 0;
}

footer {
  position: absolute;
  bottom: 10px;
  width: 100%;
  text-align: center;
}

$dark_gray: #889aa4;
$light_gray: #305868;
$main_color: #5573e4;
.login-container {
  background: #fff url("../../assets/login/background.png") no-repeat 0 0;
  background-size: 100% 100%;
  min-height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  .login-form {
    box-sizing: border-box;
    max-width: 1126px;
    width: calc(100vw - 314px);
    height: calc(100vh - 34px);
    overflow-y: auto;
    animation: show 1.2s;
    background: url("../../assets/login/box.png") no-repeat 0 50%;
    background-size: 100% auto;
    display: flex;
    align-items: center;
    padding-left:15%;
    justify-content: center;
    :deep(.el-tabs__nav-scroll) {
      display: flex;
      justify-content: center;
      width: 100%;
      .el-tabs__active-bar {
        height: 4px;
      }
      .el-tabs__nav {
        width: 50%;
        .el-tabs__item {
          width: 108px;
          height: 54px;
          line-height: 54px;
          font-size: 18px;
          font-weight: 400;
          color: #333333;
        }
      }
    }
    :deep(.el-tabs__nav) {
      float: none;
    }
    section {
      position: relative;
      width: 400px;
      // margin-top: calc(50vh - 200px);
      // margin-left: calc(38vw - 200px);
    }
    // @media screen and (min-width:1440px) and (max-width: 1700px) {
    //   section {
    //     margin-top: calc(40vh - 200px);
    //     margin-left: calc(48vw - 200px);
    //   }
    // }
    // @media (max-width: 1440px) {
    //   section {
    //     margin-top: calc(50vh - 200px);
    //     margin-left: calc(50vw - 200px);
    //   }
    // }
  }
  @media (max-width: 1440px) {
    .login-form {
      padding-left:20%;
    }
  }
  @media (max-width: 992px) {
    .login-form {
      width: calc(100% - 100px);
    }
  }
  @keyframes show {
    0% {
      opacity: 0;
      right: 100px;
    }
    100% {
      opacity: 1;
      right: 0;
    }
  }
  @keyframes hide {
    0% {
      opacity: 1;
      right: 0;
    }
    100% {
      opacity: 0;
      right: -100px;
    }
  }
  .show-enter-active {
    animation: show 1s;
  }
  .show-leave-active {
    animation: hide 0.6s;
  }
  .show-enter,
  .show-leave-to {
    opacity: 0;
  }

  .title-container {
    position: relative;
    text-align: center;

    img {
      width: 60px;
    }
    .title {
      font-size: 26px;
      // color: #5573e4;#889aa4
      color: #889aa4;
      margin: 10px auto;
      text-align: center;
      font-weight: 400;
      b {
        color: $dark_gray;
        font-weight: normal;
      }
    }
    p {
      margin-top: 0;
      font-size: 14px;
      color: $light_gray;
    }
  }
}
.qr-tip {
  margin-top: 20px;
  text-align: center;
  img {
    width: 24px;
    margin-right: 5px;
    vertical-align: -0.35em;
  }
  span {

    font-size: 16px;
    font-weight: 400;
    color: #606B85;
  }
}
</style>
